<include file="public:header" />
<div class="pad-lr-10">
  <form id="myform" name="myform" action="{:u('ad/delete')}" method="post" onsubmit="return check();">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
          	<th width=50>序号</th>
            <th width=30><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
            <th width=80>ID</th>
            <th>广告名称</th>
            <th>广告链接</th>
            <th>广告类型</th>
            <th>广告位</th>
            <th>点击量</th>
            <th width="60">排序</th>
            <th width="40">状态</th>
            <th width="80">操作</th>
          </tr>
        </thead>
        <tbody>
          <volist name="ad_list" id="val" >
          <tr>
          	<td align="center">{$val.key}</td>
            <td align="center"><input type="checkbox" value="{$val.id}" name="id[]"></td>
            <td align="center">{$val.id}</td>
            <td align="center">{$val.name}</td>
            <td align="center">{$val.url}</td>
            <td align="center">{$ad_type_arr[$val['type']]}</td>
            <td align="center">{$val.adboard_name}</td>
            <td align="center">{$val.clicks}</td>
            <td align="center"><input type="text" class="input-text-c input-text" value="{$val.ordid}" size="4" name="listorders[{$val.id}]"></td>
            <td align="center"><if condition="$val.status eq 1">
            	<font class="green">开启</font>
            <else />
            	<font color="red">关闭</font>
            </if></td>
            <td align="center"><a href="javascript:edit({$val.id},'{$val.name}')">编辑</a></td>
          </tr>
          </volist>
        </tbody>
      </table>
<div class="btn">
    <label for="check_box">{$Think.lang.select_all}/{$Think.lang.cancel}</label>
    <input type="submit" class="button" name="dosubmit" value="{$Think.lang.delete}" onclick="return confirm('{$Think.lang.sure_delete}')"/>
    <input type="submit" class="button" name="dosubmit" onclick="document.myform.action='{:u("flink/ordid")}'" value="排序"/>
    <div id="pages">{$page}</div>
    </div>
      
    </div>
  </form>
</div>
<script type="text/javascript">
function edit(ad_id, name) {
	var lang_edit = "{$Think.lang.edit}";
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:lang_edit+'--'+name,id:'edit',iframe:'?m=ad&a=edit&id='+ad_id,width:'600',height:'350'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}
var str_name = "广告";
function check(){
	if($("#myform").attr('action') != '{:u("ad/ordid")}') {
		var ids='';
		$("input[name='id[]']:checked").each(function(i, n){
			ids += $(n).val() + ',';
		});

		if(ids=='') {
			window.top.art.dialog({content:lang_please_select+str_name,lock:true,width:'200',height:'50',time:1.5},function(){});
			return false;
		}
	}
	return true;
}
</script>
</body></html>